<template>
  <template v-if="user">
    <van-cell title="当前用户" :value="user?.username"/>
    <van-cell title="修改信息" is-link to="/user/update"/>
    <van-cell title="我创建的队伍" is-link to="/user/team/create"/>
    <van-cell title="我加入的队伍" is-link to="/user/team/join"/>

  </template>
</template>

<script setup lang="ts">
// @ts-ignore
import {useRouter} from "vue-router";
// @ts-ignore
import {onMounted, ref} from "vue";

import {setCurrentUserState} from "../states/user";
// @ts-ignore
import myAxios from "../plugins/myAxios";

const router = useRouter();

const user = ref();
onMounted(async () => {
  const res = await myAxios.get('/user/current');
  if (res.code === 0 && res.data) {
    setCurrentUserState(res.data);
    user.value = res.data;
  }
});
</script>

<style scoped>

</style>
